package org.teremail.schema;

/**
 * The set of known database types.
 * 
 * @author Michael Barker
 *
 */
public class DBTypes {

    public static DBType BINARY(final int length) {
        return new DBType() {
            public String getCreate(Dialect dialect) {
                return dialect.generateBinary(length);
            }
        };
    }

    public static DBType VARCHAR(final int length) {
        return new DBType() {
            public String getCreate(Dialect dialect) {
                return dialect.getVarchar(length);
            }
        };
    }
    
    public static DBType INT4() {
        return new DBType() {
            public String getCreate(Dialect dialect) {
                return dialect.getInteger(4);
            }
        };
    }

    public static DBType INT8() {
        return new DBType() {
            public String getCreate(Dialect dialect) {
                return dialect.getInteger(8);
            }
        };
    }

    public static DBType BLOB() {
        return new DBType() {
            public String getCreate(Dialect dialect) {
                return dialect.getBlob();
            }
        };
    }

    public static DBType TIMESTAMP() {
        return new DBType() {
            public String getCreate(Dialect dialect) {
                return dialect.getTimestamp();
            }
        };
    }
    
}
